﻿using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection.Emit;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;

namespace EventBus.EntityFrameworkCore
{
    [ConnectionStringName("Default")]
    public class EventBusDbContext :
      AbpDbContext<EventBusDbContext>
    {
        /* Add DbSet properties for your Aggregate Roots / Entities here. */

        private IConfiguration configuration;
        #region Entities from the modules

        /* Notice: We only implemented IIdentityDbContext and ITenantManagementDbContext
         * and replaced them for this DbContext. This allows you to perform JOIN
         * queries for the entities of these modules over the repositories easily. You
         * typically don't need that for other modules. But, if you need, you can
         * implement the DbContext interface of the needed module and use ReplaceDbContext
         * attribute just like IIdentityDbContext and ITenantManagementDbContext.
         *
         * More info: Replacing a DbContext of a module ensures that the related module
         * uses this DbContext on runtime. Otherwise, it will use its own DbContext class.
         */

        public DbSet<Student> Student { get; set; }
        public DbSet<Score> Score { get; set; }

        #endregion



        public EventBusDbContext(DbContextOptions<EventBusDbContext> options)
            : base(options)
        {
           
        }



        protected override void OnModelCreating(ModelBuilder builder)
        {
            base.OnModelCreating(builder);
           
          
            /* Include modules to your migration db context */

            /* Configure your own tables/entities inside here */

            //builder.Entity<YourEntity>(b =>
            //{
            //    b.ToTable(CollegeTecManageSystemConsts.DbTablePrefix + "YourEntities", CollegeTecManageSystemConsts.DbSchema);
            //    b.ConfigureByConvention(); //auto configure for the base class props
            //    //...
            //});
        }
    }
}
